package project02.dao;

import java.util.List;
import java.util.logging.Logger;
import javax.jdo.PersistenceManager;
import org.slim3.jdo.SelectQuery;
import project02.model.DateData;
import project02.meta.DateDataMeta;
import org.slim3.jdo.GenericDao;

public class DateDataDao extends GenericDao<DateData> {

    private static final DateDataMeta m = new DateDataMeta();

    @SuppressWarnings("unused")
    private static final Logger logger = Logger.getLogger(DateDataDao.class.getName());

    public DateDataDao() {
        super(DateData.class);
    }


    public DateDataDao(PersistenceManager pm) {
        super(DateData.class, pm);
    }

    @Override
    protected SelectQuery<DateData> from() {
        return new SelectQuery<DateData>(pm, m.getModelClass());
    }

    public List<DateData> findAllByUser(String userId) {
        return from().where(m.userId.eq(userId)).orderBy(m.dataId.asc()).getResultList();
    }
}
